package com.qf.bbapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.bbapi.dao.TCoincertificateDao;
import com.qf.bbapi.entity.TCoincertificate;
import com.qf.bbapi.service.intf.TCoincertificateService;
import com.qf.bbapi.vo.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * .::::.
 * .::::::::.
 * :::::::::::
 * ..:::::::::::'
 * '::::::::::::'
 * .::::::::::
 * '::::::::::::::..
 * ..::::::::::::.
 * ``::::::::::::::::
 * ::::``:::::::::'        .:::.
 * ::::'   ':::::'       .::::::::.
 * .::::'      ::::     .:::::::'::::.
 * .:::'       :::::  .:::::::::' ':::::.
 * .::'        :::::.:::::::::'      ':::::.
 * .::'         ::::::::::::::'         ``::::.
 * ...:::           ::::::::::::'              ``::.
 * ````':.          ':::::::::'                  ::::..
 * '.:::::'                    ':'````..
 *
 * @author 贾
 * @version 1.0
 * @description: TODO
 * @date 2022/7/3 12:50
 */
@Service
public class TCoincertificateImpl implements TCoincertificateService {
    @Resource
    private TCoincertificateDao dao;

    @Override
    public R all(int token) {
        if(token > 0) {
            TCoincertificate uid = dao.selectOne(new QueryWrapper<TCoincertificate>().eq("uid", token));
            if (uid == null) {
//                uid.setDayticket(0);
//                uid.setMtso(0);
//                uid.setGiftCertificates(0);
//                uid.setGiftCoupons(0);
                return R.ok(uid);
            } else {
                return R.ok(uid);
            }
        }
        return R.fail();
    }
}
